/**
 * @param {number} m
 * @param {number} n
 * @return {number}
 */
// 败北
 var colorTheGrid = function(m, n) {
    const dp = new Array(m).fill(0).map(() => new Array(n).fill(0))
    const mod = 1e9+7
    dp[0][0] = 3
    for(let i = 1; i<n; i++){
        dp[0][i] = dp[0][i-1]*2
    }
    for(let i = 1; i<m; i++){
        dp[i][0] = dp[i-1][0]*2
    }
    for(let i = 1; i<m; i++){
        dp[i][0] = dp[i-1][n-1]*dp[i][0]%mod
        for(let j = 1; j<n; j++){
            dp[i][j] = dp[i][j-1]*(3/2)**j% mod
        }
    }
    return dp[m-1][n-1]
};